<span class="titulo">Índice de Sucesso de OSs</span>
<?php
$link = sybase_connect('getbo', 'carga', 'carga2006') or die("Could not connect !");
$db = sybase_select_db('getbo', $link);
$sql = "select
	dateformat(dt_atendimento, 'dd/mm') as dia,
	count(nr_ordem_servico_ars) as qt_os
from
	dba.fato_ordem_servico fos
where
	cd_situacao_os = -6
	and dt_atendimento between  dateformat(dateadd(dd, -1, today()), 'yyyymm01') and dateformat(dateadd(dd, -1, today()), 'yyyymmdd')
	and dateformat(dt_atendimento, 'ddd') <> 'Sun'
group by
	dateformat(dt_atendimento, 'dd/mm')
order by
	dateformat(dt_atendimento, 'dd/mm')";
$rs = sybase_query($sql, $link);

$FC2 = new FusionCharts("MSLine", "1200", "300");
		
$FC2->setSwfPath("FusionChartsFree/Charts/");
		 
$strParam2="xAxisName=Meses;pYAxisName=Base Instalada;sYAxisName=Base Ativa;decimalPrecision=1;";
$FC2->addColors("63B8FF;DAA520;66CDAA;EEEE00");
$FC2->setChartParams($strParam2);

while ($linha = sybase_fetch_assoc($rs)) {
	$FC2->addCategory($linha["dia"]);
}	

$rs = sybase_query($sql, $link);
$FC2->addDataset("GET","showValues=1");
while ($linha = sybase_fetch_assoc($rs)) {
	$FC2->addChartData($linha["qt_os"]);	
}

$FC2->addTrendLine("startValue=200;color=ff0000;displayvalue=Meta");

$FC2->addTrendLine("startValue=270;color=0000ff;displayvalue=Desafio");

$FC2->renderChart();

sybase_close($link);